Description:
AFP detects the code that assigns to a method parameter. This includes modifications made to the parameter with increment or decrement operators.
Incorrect:
int discount(int inputVal, int quantity, int yearToDate) {
if (inputVal > 50) {
inputVal -= 50;
}
...
}
Correct:
int discount(int inputVal, int quantity, int yearToDate) {
int tmp = inputVal;
if (tmp > 50) {
tmp -= 50;
}
...
}